package com.etoak.controller.advice;

import com.etoak.commons.vo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理器
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandle {

    @ExceptionHandler(RuntimeException.class)
    public ResultVO handle(RuntimeException e){
      log.error(e.getMessage(),e);
      return ResultVO.error(e.getMessage());
    }
}
